package com.ssy.jt808.gateway.sdk.terminal.converter.location.addition.jsatl12;

import com.ssy.jt808.gateway.sdk.terminal.constant.location.addition.jsatl12.AlarmVehicleStateBitConstant;
import com.ssy.jt808.gateway.sdk.terminal.pojo.info.alarm.AlarmVehicleStateInfo;
import com.ssy.jt808.gateway.sdk.terminal.utils.BitUtil;

/**
 * Adas 或 Dsm 报警车量状态信息转换
 *
 * @author wangzezhou
 */
public class AlarmVehicleStateInfoConverter{


  public static AlarmVehicleStateInfo convertVehicleStateInfo( int state ){

    AlarmVehicleStateInfo vehicleStateInfo = new AlarmVehicleStateInfo();

    vehicleStateInfo.setAccOn(BitUtil.existFlag(state, AlarmVehicleStateBitConstant.ACC));
    vehicleStateInfo.setLeftTurnOn(BitUtil.existFlag(state, AlarmVehicleStateBitConstant.LEFT_TURN));
    vehicleStateInfo.setRightTurnOn(BitUtil.existFlag(state, AlarmVehicleStateBitConstant.RIGHT_TURN));
    vehicleStateInfo.setWiperWashOn(BitUtil.existFlag(state, AlarmVehicleStateBitConstant.WIPER_WASH));
    vehicleStateInfo.setBraking(BitUtil.existFlag(state, AlarmVehicleStateBitConstant.BRAKING));
    vehicleStateInfo.setPluginCard(BitUtil.existFlag(state, AlarmVehicleStateBitConstant.PLUGIN_CARD));
    vehicleStateInfo.setLocating(BitUtil.existFlag(state, AlarmVehicleStateBitConstant.LOCATING));

    return vehicleStateInfo;
  }
}
